package net.tccn.kit.poi;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;

/**
 * Created by liangxianyou at 2018/6/27 16:15.
 */
public class ExcelExportKit {
    public static final ThreadLocal<SimpleDateFormat> SDF_THREADLOCAL = new ThreadLocal<>();

    //-------------非poi导出---------------
    public static <T,U,R> StringBuilder exportExcel(Map<String, String> head, List<T> rows, BiFunction<T,U,R> fun) {
        long start = System.currentTimeMillis();

        StringBuilder buf = new StringBuilder();
        buf.append(EXCEL_HEAD);
        buf.append(createBody(head, rows, fun));//body
        buf.append(EXCEL_END);

        System.out.println(String.format("数据：%s条，耗时：%s ms", rows.size(), System.currentTimeMillis() - start));
        return buf;
    }

    private static <T,U,R> StringBuilder createBody(Map<String, String> head, List<T> rows, BiFunction<T,U,R> fun) {
        StringBuilder buf = new StringBuilder();
        //table-head
        buf.append("<Row ss:StyleID=\"s50\" ss:Height=\"16\">");
        head.forEach((k,v)->{
            buf.append("<Cell ss:StyleID=\"s51\"><Data ss:Type=\"String\">"+k+"</Data> </Cell>");
        });
        buf.append("</Row>");

        //table-body
        rows.forEach(x->{
            buf.append("<Row>");
            head.forEach((k,v)->{
                Object value = fun.apply(x, (U)v);
                if (value == null) value = "";
                if (value instanceof Number){
                    buf.append("<Cell><Data ss:Type=\"Number\">"+value+"</Data> </Cell>");
                }else if (value instanceof Date){
                    SimpleDateFormat dateFormat = SDF_THREADLOCAL.get();
                    if (dateFormat == null) {//ThreadLocal 存贮 simpleDateFormat 对象
                        SDF_THREADLOCAL.set(dateFormat = new SimpleDateFormat());
                    }

                    buf.append(
                            "<Cell><Data ss:Type=\"String\">"+ dateFormat.format(value) +"</Data> </Cell>"
                    );
                }else {
                    buf.append("<Cell><Data ss:Type=\"String\">"+value+"</Data> </Cell>");
                }
            });
            buf.append("</Row>");
        });

        return buf;
    }

    public static <T,U,R> void exportExceltoFile(Map<String,String> head, List<T> rows, File file, BiFunction<T,U,R> fun) throws IOException {
        StringBuilder buf = exportExcel(head, rows, fun);

        strToFile(buf.toString(), file);
    }

    public static void strToFile(String entityBody, File file) throws IOException {

        if (file.exists()) file.delete();
        //throw new RuntimeException(file.getPath() + "已经存在");

        if (!file.getParentFile().exists()) file.getParentFile().mkdirs();
        FileOutputStream out = new FileOutputStream(file);
        out.write(entityBody.getBytes("UTF-8"));
        out.close();
    }

    public static class TC {
        public static final BiFunction BEAN = (t,u)->{
            Field field = null;
            try {
                field = t.getClass().getDeclaredField((String) u);
                field.setAccessible(true);//暴力反射
                Object o = field.get(t);//得到字段数据的值
                return o;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "";
        };

        public static final BiFunction MAP = (t,u)->{
            return ((Map)t).get(u);
        };
    }

    private static String EXCEL_HEAD = "<?xml version=\"1.0\" encoding=\"utf-8\"?><?mso-application progid=\"Excel.Sheet\"?><Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\" xmlns:dt=\"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882\"><DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"><Author>lxy-kit</Author><LastAuthor>lxy208</LastAuthor></DocumentProperties><CustomDocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"><KSOProductBuildVer dt:dt=\"string\">2052-10.1.0.7245</KSOProductBuildVer></CustomDocumentProperties><ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\"><WindowWidth>22395</WindowWidth><WindowHeight>12045</WindowHeight><ProtectStructure>False</ProtectStructure><ProtectWindows>False</ProtectWindows></ExcelWorkbook><Styles><Style ss:ID=\"Default\" ss:Name=\"Normal\"><Alignment/><Borders/><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"12\"/><Interior/><NumberFormat/><Protection/></Style><Style ss:ID=\"s47\" ss:Name=\"40% - 强调文字颜色 6\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#C6E0B4\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s28\" ss:Name=\"强调文字颜色 2\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#ED7D31\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s21\" ss:Name=\"60% - 强调文字颜色 1\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#9BC2E6\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s16\" ss:Name=\"警告文本\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FF0000\"/></Style><Style ss:ID=\"s8\" ss:Name=\"千位分隔\"><NumberFormat ss:Format=\"_ * #,##0.00_ ;_ * \\-#,##0.00_ ;_ * &quot;-&quot;??_ ;_ @_ \"/></Style><Style ss:ID=\"s40\" ss:Name=\"强调文字颜色 4\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#FFC000\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s33\" ss:Name=\"20% - 强调文字颜色 5\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#D9E1F2\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s19\" ss:Name=\"标题 1\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"2\" ss:Color=\"#5B9BD5\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"15\" ss:Color=\"#44546A\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s4\" ss:Name=\"货币\"><NumberFormat ss:Format=\"_ &quot;￥&quot;* #,##0.00_ ;_ &quot;￥&quot;* \\-#,##0.00_ ;_ &quot;￥&quot;* &quot;-&quot;??_ ;_ @_ \"/></Style><Style ss:ID=\"s6\" ss:Name=\"40% - 强调文字颜色 3\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#DBDBDB\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s42\" ss:Name=\"40% - 强调文字颜色 4\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#FFE699\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s35\" ss:Name=\"20% - 强调文字颜色 1\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#DDEBF7\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s27\" ss:Name=\"20% - 强调文字颜色 6\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#E2EFDA\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s5\" ss:Name=\"千位分隔[0]\"><NumberFormat ss:Format=\"_ * #,##0_ ;_ * \\-#,##0_ ;_ * &quot;-&quot;_ ;_ @_ \"/></Style><Style ss:ID=\"s36\" ss:Name=\"40% - 强调文字颜色 1\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#BDD7EE\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s18\" ss:Name=\"解释性文本\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#7F7F7F\" ss:Italic=\"1\"/></Style><Style ss:ID=\"s13\" ss:Name=\"注释\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#B2B2B2\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#B2B2B2\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#B2B2B2\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#B2B2B2\"/></Borders><Interior ss:Color=\"#FFFFCC\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s9\" ss:Name=\"60% - 强调文字颜色 3\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#C9C9C9\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s2\" ss:Name=\"20% - 强调文字颜色 3\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#EDEDED\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s41\" ss:Name=\"20% - 强调文字颜色 4\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#FFF2CC\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s23\" ss:Name=\"60% - 强调文字颜色 4\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#FFD966\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s14\" ss:Name=\"60% - 强调文字颜色 2\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#F4B084\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s1\" ss:Name=\"货币[0]\"><NumberFormat ss:Format=\"_ &quot;￥&quot;* #,##0_ ;_ &quot;￥&quot;* \\-#,##0_ ;_ &quot;￥&quot;* &quot;-&quot;_ ;_ @_ \"/></Style><Style ss:ID=\"s32\" ss:Name=\"适中\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#9C6500\"/><Interior ss:Color=\"#FFEB9C\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s7\" ss:Name=\"差\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#9C0006\"/><Interior ss:Color=\"#FFC7CE\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s25\" ss:Name=\"计算\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FA7D00\" ss:Bold=\"1\"/><Interior ss:Color=\"#F2F2F2\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s3\" ss:Name=\"输入\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#7F7F7F\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#3F3F76\"/><Interior ss:Color=\"#FFCC99\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s46\" ss:Name=\"强调文字颜色 6\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#70AD47\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s44\" ss:Name=\"40% - 强调文字颜色 5\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#B4C6E7\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s38\" ss:Name=\"40% - 强调文字颜色 2\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#F8CBAD\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s12\" ss:Name=\"已访问的超链接\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#800080\" ss:Underline=\"Single\"/></Style><Style ss:ID=\"s10\" ss:Name=\"超链接\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#0000FF\" ss:Underline=\"Single\"/></Style><Style ss:ID=\"s43\" ss:Name=\"强调文字颜色 5\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#4472C4\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s37\" ss:Name=\"20% - 强调文字颜色 2\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#FCE4D6\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s34\" ss:Name=\"强调文字颜色 1\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#5B9BD5\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s11\" ss:Name=\"百分比\"><NumberFormat ss:Format=\"0%\"/></Style><Style ss:ID=\"s20\" ss:Name=\"标题 2\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"2\" ss:Color=\"#5B9BD5\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"13\" ss:Color=\"#44546A\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s15\" ss:Name=\"标题 4\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#44546A\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s48\" ss:Name=\"60% - 强调文字颜色 6\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#A9D08E\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s45\" ss:Name=\"60% - 强调文字颜色 5\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#8EA9DB\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s39\" ss:Name=\"强调文字颜色 3\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\"/><Interior ss:Color=\"#A5A5A5\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s17\" ss:Name=\"标题\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"18\" ss:Color=\"#44546A\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s24\" ss:Name=\"输出\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#3F3F3F\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#3F3F3F\" ss:Bold=\"1\"/><Interior ss:Color=\"#F2F2F2\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s22\" ss:Name=\"标题 3\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"2\" ss:Color=\"#ACCCEA\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#44546A\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s26\" ss:Name=\"检查单元格\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Left\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#3F3F3F\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#3F3F3F\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FFFFFF\" ss:Bold=\"1\"/><Interior ss:Color=\"#A5A5A5\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s29\" ss:Name=\"链接单元格\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#FF8001\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#FA7D00\"/></Style><Style ss:ID=\"s30\" ss:Name=\"汇总\"><Borders><Border ss:Position=\"Bottom\" ss:LineStyle=\"Double\" ss:Weight=\"3\" ss:Color=\"#5B9BD5\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#5B9BD5\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\" ss:Bold=\"1\"/></Style><Style ss:ID=\"s31\" ss:Name=\"好\"><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#006100\"/><Interior ss:Color=\"#C6EFCE\" ss:Pattern=\"Solid\"/></Style><Style ss:ID=\"s49\"/><Style ss:ID=\"s50\"><Alignment/><Borders/><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior/></Style><Style ss:ID=\"s51\"><Alignment ss:Horizontal=\"Left\" ss:WrapText=\"1\"/><Borders><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#33CCCC\" ss:Pattern=\"Solid\"/><NumberFormat/></Style><Style ss:ID=\"s52\"><Alignment ss:Horizontal=\"Center\" ss:WrapText=\"1\"/><Borders><Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/><Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/></Borders><Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/><Interior ss:Color=\"#33CCCC\" ss:Pattern=\"Solid\"/><NumberFormat/></Style></Styles><Worksheet ss:Name=\"lxy\"><Table ss:ExpandedColumnCount=\"\" ss:ExpandedRowCount=\"2\" x:FullColumns=\"1\" x:FullRows=\"1\" ss:DefaultColumnWidth=\"112.15\" ss:DefaultRowHeight=\"15.75\">";

    private static String EXCEL_END = "</Table><WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\"><PageSetup><Header x:Margin=\"0.509722222222222\"/><Footer x:Margin=\"0.509722222222222\"/></PageSetup><Selected/><TopRowVisible>0</TopRowVisible><LeftColumnVisible>0</LeftColumnVisible><PageBreakZoom>100</PageBreakZoom><Panes><Pane><Number>3</Number><ActiveRow>9</ActiveRow><ActiveCol>3</ActiveCol><RangeSelection>R10C4</RangeSelection></Pane></Panes><ProtectObjects>False</ProtectObjects><ProtectScenarios>False</ProtectScenarios></WorksheetOptions></Worksheet><Worksheet ss:Name=\"Sheet2\"><Table ss:ExpandedColumnCount=\"1\" ss:ExpandedRowCount=\"1\" x:FullColumns=\"1\" x:FullRows=\"1\" ss:DefaultColumnWidth=\"54\" ss:DefaultRowHeight=\"15.75\"/><WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\"><PageSetup><Header x:Margin=\"0.509722222222222\"/><Footer x:Margin=\"0.509722222222222\"/></PageSetup><TopRowVisible>0</TopRowVisible><LeftColumnVisible>0</LeftColumnVisible><PageBreakZoom>100</PageBreakZoom><ProtectObjects>False</ProtectObjects><ProtectScenarios>False</ProtectScenarios></WorksheetOptions></Worksheet></Workbook>";
}
